let includes = ([
    "include/common.js",
    "include/global.js"
]);

let inherits = ([
    "inherit/data.js",
]);

let os = com.far.x.utils.script.OsKit;

function create() {
    return thisObject;
}



//程序入口......
//FarOS循环调用main方法....
let x;




let cc = cc || {};
let MetaClass = {};

let Class = function () {
};

Class.extends = function (ary) {
    Class["extendData"] = [];
    Class["extendData"] = ary;
    return Class;
};


Class.define = function (clazz) {
    let obj = new Object();
    obj["clazz"] = clazz;
    if (undefined != Class.extendData && Class.extendData.length > 0) {
        let parentData = Class.extendData[0]().clazz;
        if (parentData && typeof parentData === "object" && parentData.hasOwnProperty) {
            for (key in parentData) {
                if (parentData.hasOwnProperty(key)) {
                    //如果不是，简单复制
                    obj[key] = parentData[key];
                }
            }
        }

    }
    let propKeys = Object.keys(clazz);
    for (let e in propKeys) {
        obj[propKeys[e]] = clazz[propKeys[e]];
    }

    return function (a, b) {
        return obj;
    }
}



MetaClass["Data"] = Class.extends().define({
    data:{
        name:"",
    },
    ctor: (pParam1, pParam2)=>  {
        this.pMember = pParam1;
        //测试多参数
        console.log("args param :", pParam1, pParam2);
    },
    set:  (k,v)=> {
        os.debug(this);
        this.data[k] = v;
    },
    get:  (k)=> {
        return this.data[k];
    },
})



MetaClass["Char"] = Class.extends().define({
    pMember: "Char",
    ctor: function (pParam1, pParam2) {
        this.pMember = pParam1;
        //测试多参数
        console.log("args param :", pParam1, pParam2);
    },

    skill: function () {
        os.debug(this.pMember);
    }
})


//自定义类
MetaClass["User"] = Class.extends([MetaClass.Data]).define({
    pMember: "User",
    data:{
        name:"",
    },
    ctor: function (pParam1, pParam2) {
        this.pMember = pParam1;
        //测试多参数
        console.log("args param :", pParam1, pParam2);
    },
    skill: function () {
        os.debug(this.pMember);
    },
    test: function () {
        os.debug(this.pMember);
    }
})


function main() {

    var user = new MetaClass.User("test1", "test2");
    user.set("name","张三");
    os.debug(user.get("name"));



    return true;
}

